home *** CD-ROM | disk | FTP | other *** search
- /************************************************************
- *
- * Created: Wednesday, November 24, 1993 19:25:00
- *
- * CNeoStream.h
- *
- * C++ class implementation for NeoAccess abstract stream class
- *
- * Most C++ compilers include a standard set of classes which
- * implement an input/output facility which is referred to as
- * a stream. The most common stream class supports the
- * transfer of basic C data types such as integers, floating-
- * point numbers and character strings to and from a database.
- *
- * While streams have been around for some time, our
- * understanding of them continues to evolve. We know, for
- * example, that we need different types of streams for
- * different purposes. Application-specific environments may
- * benefit from the use of a stream subclass which also
- * supports application-specific data types, an imaginary
- * number for instance. Other environments may find useful a
- * stream that transfers data not to a database but across a
- * network pipe or an interprocess communications channel. As
- * you can see from these two examples, there are two
- * directions in which stream derivations can occur. One
- * direction addresses the type of data being accessed. The
- * other defines the source/destination of the data.
- *
- * NeoAccess releases 2.2 and later use a construct called a
- * stream to address the issue of where data is coming from or
- * going to. The abstract base class CNeoStream provides an
- * interface through which basic data types can be read in or
- * written out. This base class is subclassed to build a stream
- * class, CNeoFileStream, for reading from and writing to a
- * file.
- *
- * The NeoAccess database class, CNeoDatabase, provides an extremely
- * powerful mechanism for accessing persistent objects. These
- * objects use persistence properties provided by their base
- * class, CNeoPersist. And together these three base classes -
- * CNeoStream, CNeoDatabase and CNeoPersist - create an incredibly
- * powerful and high performance database engine which is both
- * extensible and easy to use.
- *
- * Copyright © Neologic Systems 1992-1994. All Rights Reserved.
- * All rights reserved
- *
- *
- ***********************************************************/
- #pragma once /* Include this file only once */
- #ifndef __CNeoStream__
- #define __CNeoStream__ 1
-
- #include "NeoTypes.h"
-
- class CNeoPerist;
-
- class CNeoStream
- {
- public:
- /** Instance Methods **/
- CNeoStream(void);
- virtual ~CNeoStream(void);
-
- /** Access Methods **/
- virtual void close(void);
- virtual void flush(const Boolean aEntireStream = FALSE);
- virtual OSType getCreator(void) const;
- virtual long getLength(void) const;
- virtual NeoMark getMark(void) const;
- virtual OSType getStreamType(void) const = 0;
- virtual OSType getType(void) const;
- virtual Boolean isOpen(void) const;
- virtual void setCreator(const OSType aCreator);
- virtual void setLength(const long aLength, const Boolean aReallySet = FALSE);
- virtual void setMark(const NeoMark aMark);
- virtual void setType(const OSType aType);
-
- /** Structuring Methods **/
- virtual void closeList(void);
- virtual void openList(const NeoTag aTag = kNeoNoTag);
-
- /** I/O Methods **/
- virtual void readBits(void *aBits, const short aCount, const NeoTag aTag = kNeoNoTag);
- virtual NeoBlob readBlob(const NeoMark aMark, long &aLength, const NeoTag aTag = kNeoNoTag);
- virtual char readChar(const NeoTag aTag = kNeoNoTag);
- virtual void readChunk(void *aBuffer, const long aLength, const NeoTag aTag = kNeoNoTag) = 0;
- virtual NeoFloat readFloat(const NeoTag aTag = kNeoNoTag);
- virtual NeoDouble readDouble(const NeoTag aTag = kNeoNoTag);
- virtual NeoLongDouble
- readLongDouble(const NeoTag aTag = kNeoNoTag);
- virtual long readLong(const NeoTag aTag = kNeoNoTag);
- virtual Boolean readBoolean(const NeoTag aTag = kNeoNoTag);
- virtual void readNativeString(CNeoString &aString, const long aMaxLength = 0, const NeoTag aTag = kNeoNoTag);
- virtual void readObject(CNeoPersist *aObject, const NeoTag aTag = kNeoNoTag);
- virtual short readShort(const NeoTag aTag = kNeoNoTag);
- virtual void readString(void *aBuffer, const long aLength, const NeoTag aTag = kNeoNoTag);
-
- virtual void writeBits(const void *aBits, const short aCount, const NeoTag aTag = kNeoNoTag);
- virtual void writeBlob(NeoBlob aBlob, const NeoMark aMark, const long aLength, const NeoTag aTag = kNeoNoTag);
- virtual void writeChar(const char aValue, const NeoTag aTag = kNeoNoTag);
- virtual void writeChunk(const void *aBuffer, const long aLength, const NeoTag aTag = kNeoNoTag) = 0;
- virtual void writeFloat(const NeoFloat &aValue, const NeoTag aTag = kNeoNoTag);
- virtual void writeDouble(const NeoDouble &aValue, const NeoTag aTag = kNeoNoTag);
- virtual void writeLongDouble(const NeoLongDouble &aValue, const NeoTag aTag = kNeoNoTag);
- virtual void writeLong(const long aValue, const NeoTag aTag = kNeoNoTag);
- virtual void writeBoolean(const Boolean aBool, const NeoTag aTag = kNeoNoTag);
- virtual void writeNativeString(const CNeoString &aString, const long aMaxLength, const NeoTag aTag = kNeoNoTag);
- virtual void writeObject(CNeoPersist *aObject, const NeoTag aTag = kNeoNoTag);
- virtual void writeShort(const short aValue, const NeoTag aTag = kNeoNoTag);
- virtual void writeString(const void *aString, const long aMaxLength, const NeoTag aTag = kNeoNoTag);
-
- /*** Instance Variables ***/
- NeoMark fMark; // current mark for this database
- long fLength; // length of stream
- };
-
- #endif
-